package com.wise.service.portal.content.productindustrys;

import com.wise.entities.content.Product;
import com.wise.framework.dao.SqlSelect;
import com.wise.framework.daomodel.DaoPageList;
import com.wise.framework.restful.PageResultList;
import com.wise.summer.v1.portal.content.productindustrys.PageListProductIndustrys;
import org.springframework.stereotype.Service;
import org.summerframework.model.SummerService;
import org.summerframework.model.SummerServiceBean;

@Service
@SummerService
public class PageListIndustryService implements SummerServiceBean<PageListProductIndustrys> {


    @Override
    public void sum(PageListProductIndustrys summer) {
        SqlSelect sqlSelect = SqlSelect.selec("*")
                .fromClassName(Product.class)
                .eq(Product._categoryType, 1)
                .eqLang(Product._lang)
                .order_by(Product._sort)
                .order_by(Product._id + " desc");

        PageResultList<Product> productList = DaoPageList.s(Product.class, sqlSelect, summer.getStart(), summer.getLimit());

        summer.setSummerResult(productList);
    }
}
